<template>
	<a-card class="portal_common_card" :title="cardTitle">
		<template #title v-if="isHasTitleSlot"><slot name="header"></slot></template>
		<template #extra v-if="isHasMoreSlot"><slot name="more"></slot></template>
		<slot></slot>
	</a-card>
</template>

<script lang="ts" setup>
interface Prop {
	title?: string;
	header?: boolean;
}
const props = withDefaults(defineProps<Prop>(), { header: true });
const isHasTitleSlot = computed(() => !!useSlots().header);
const isHasMoreSlot = computed(() => !!useSlots().more);
const cardTitle = computed(() => (props.header ? props.title : ''));
</script>

<style lang="scss" scoped>
.arco-card.portal_common_card {
	display: flex;
	flex-direction: column;
	width: 100%;
	height: 100%;
	overflow: hidden;
	border-radius: 4px;
	box-sizing: border-box;
	border: solid 1px var(--color-border-2);
	&:deep(.arco-card-header) {
		padding: 0;
		flex-shrink: 0;
		user-select: none;
		.arco-radio-group {
			display: flex;
			align-items: center;
			margin: 0 -16px;
			padding: 6px;
		}
		.arco-radio {
			margin: 0;
			padding: 0;
		}
		.arco-tag-checked {
			background-color: var(--color-fill-4);
		}
		.arco-btn {
			background-color: transparent;
		}
	}
	&:deep(.arco-card-header-title) {
		padding: 0 16px;
		font-size: 15px;
		font-weight: bold;
	}
	&:deep(.arco-card-body) {
		display: flex;
		padding: 0;
		flex: 1;
		overflow: auto;
	}
}
</style>
